package com.sf.fy.uav.rest;

import com.sf.fy.uav.common.request.operate.ActivityAddRequest;
import com.sf.fy.uav.common.request.operate.ActivityEditRequest;
import com.sf.fy.uav.common.request.operate.SysActivityRequest;
import com.sf.fy.uav.common.request.order.DealRequest;
import com.sf.fy.uav.common.response.operational.SysActivityResponse;
import com.sf.fy.uav.entity.Activity;
import com.sf.fy.uav.entity.ActivityRewardRules;
import com.sf.fy.uav.service.IActivityService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 活动表 前端控制器
 * </p>
 *
 * @author LTQ
 * @since 2023-08-16
 */
@RestController
@RequestMapping("/sys/activity")
@Api(value = "活动设置管理")
public class ActivityRest {
    @Autowired
    private IActivityService iActivityService;

    public void addActivity(ActivityAddRequest activityAddRequest) {
        iActivityService.addActivity(activityAddRequest);
    }


    public void editActivity(ActivityEditRequest activityEditRequest) {
        iActivityService.editActivity(activityEditRequest);
    }

    public Long getTotal(@RequestParam(required = false) String name,
                         @RequestParam(required = false) Integer status) {
        return iActivityService.getTotal(name, status);
    }

    public List<SysActivityResponse> getActivity(SysActivityRequest sysActivityRequest) {
        return iActivityService.getActivity(sysActivityRequest);
    }

    public void off(@RequestBody DealRequest dealRequest) {
        iActivityService.off(dealRequest);
    }


    public void delete(@RequestBody DealRequest dealRequest) {
        iActivityService.delete(dealRequest);
    }

    public BigDecimal getByType(@RequestParam(required = false) Integer type) {
        return iActivityService.getByType(type);
    }

    public Activity getSettings(Integer type) {
        return iActivityService.getSettings(type);
    }


    public Activity getSettings(String activityId) {
        return iActivityService.getSettings(activityId);
    }


    public ActivityRewardRules getSettingsByProductType(Byte productType, String activityId) {
        return iActivityService.getSettingsByProductType(productType, activityId);
    }


    public Boolean checkEffectiveness(String activityId) {
        return iActivityService.checkEffectiveness(activityId);
    }

    public void autoLoadAndUnload() {
//        return  iActivityService.autoLoadAndUnload();
    }
}
